//q2a.cpp
//This program takes a 3 digit number and divide it by 3 and multiply it by 3
//
//Binyamin 22 december 2017
//-----------------------------------------------------------
#include <iostream>

using namespace std;
//1. prompt the user for three digits.
//2. store the three digits in char form.
//3. convert them to integers.
//4. create a full integer with thoes numbers.
//5. print the full number times 3.
//6. print the full number divided by 3.

int main()
{
	char digit0, digit1, digit2; // digit* - used to capture the digits from the user.
	int idigit0, idigit1, idigit2; //idigit* - used to store the digits in integer form.
	int num; //num the number calculated from the user input.
	cout << "Please enter three digits" << endl;
	cin >> digit0 >> digit1 >> digit2;
	idigit0 = digit0 - '0';
	idigit1 = digit1 - '0';
	idigit2 = digit2 - '0';
	num = idigit2 + idigit1 * 10 + idigit0 * 100;
	cout << "The " << num << " * 3 is " << num * 3 << endl \
		<< "The " << num << " / 3 is " << (double)num / 3 << endl;
	
	return 0;
}
//output
//Please enter three digits
//3 4 5
//The 345 * 3 is 1035
//The 345 / 3 is 115
